import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"
import Layout from "@/layout/index.vue"
import routes from "./routes";
import setting from "@/config/setting"

let r: RouteRecordRaw[] = routes.map((route) => {
    if (setting.WHITE_LAYOUT_URL.includes(route.path)) {
        return route
    } else {
        return {
            path: '/',
            component: Layout,
            children: [route]
        }
    }

})

const router = createRouter({
    routes: r,
    history: createWebHashHistory()
});

export default router;